﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace Lhz.Data.Linq
{
    public interface ILinqProxy : IDisposable
    {
        IQueryable<TEntity> Query<TEntity>();

        TEntity QueryByPk<TPk, TEntity>(TPk pk);

        void ClearCache();

        void Add<TEntity>(TEntity item);

        void Add<TEntity>(IEnumerable<TEntity> items);

        void Update<TEntity>(TEntity item) where TEntity : class;

        void Update<TEntity>(IEnumerable<TEntity> items) where TEntity : class;

        void Delete<TEntity>(TEntity item) where TEntity : class;

        void Delete<TEntity>(IEnumerable<TEntity> items) where TEntity : class;

        void DeleteByPk<TPk, TEntity>(TPk pk);

        void DeleteByPk<TPk, TEntity>(IEnumerable<TPk> pks);

        void SaveChanges();
    }
}
